<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>OOG</title>
		<script type="text/javascript">
			window.onload = function(){
				var trs = document.getElementsByTagName("tr");
				for(var i=0;i<trs.length;i++){
					if(i%2==0){
						/*其实backgroundColor在css中的原型是:background-color,必须改成backgroundColor */
						trs[i].style.backgroundColor="red";
					}else{
						trs[i].style.backgroundColor="yellow";
					}
				}
			}
		</script>
	</head>
	<body>
		<br><a href="../index.jsp">back</a>
		<br><hr color="red" />
		<h5>javascript控制表格css</h5>
		<table border="1" width="80" align="left" cellpadding="0" cellspacing="0" >
			<tr><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td></tr>
			<tr><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td></tr>
			<tr><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td></tr>
			<tr><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td></tr>
			<tr><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td></tr>
			<tr><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td></tr>
			<tr><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td><td>demo</td></tr>
		</table>
	</body>
</html>